var content = $("#content");
var id = getUrlParam('id');
$(document).ready(function(){
    loadPage();
});
function loadPage() {
    var data = {
        id : id,
        blogId : id,
    };
    $.ajax({
        url : '/blog/getBlogById',
        type : 'get',
        dataType : 'json',
        data : data,
        success : function(data) {
            var htmlContent = '';

            if(data.code == 200 ){
                htmlContent = data.result.content;
            }else{

            }
            content.html(htmlContent);
        },
        error : function() {
            alert("异常！");
        }
    });

    $.ajax({
        url : '/blog/getBlogVideo',
        type : 'get',
        dataType : 'json',
        data : data,
        success : function(data) {
            var htmlContent = '';

            if(data.code == 200 ){
                var result = data.dataList;
                $(result).each(function (index, item) {
                    htmlContent += '<div>';
                    htmlContent += '<video src="'+ item.videoUrl + '" controls="controls" width="800px" height="600px"></video>';
                    htmlContent += '</div>';
                });
                content.before(htmlContent)
            }else{

            }

        },
        error : function() {
            alert("异常！");
        }
    });
}